/**
 * 窗口工具类
 * @author huyunming
 * @createTime 20160708
 * @param winId
 */

/* 关闭 */
function closeWindow(winId) {
	var win = Ext.getCmp(winId);
	win.close();
}

/* 最大化 */
function maxWindow(winId) {
	var win = Ext.getCmp(winId);
	win.maximize();
}

/* 最小化 */
function minWindow(winId) {
	var win = Ext.getCmp(winId);
	win.minimize();
}

/* 居中 */
function centerWindow(winId) {
	var win = Ext.getCmp(winId);
	if(win.getInnerHeight()>0){
		win.center();
	}
}

/* 隐藏 */
function hideWindow(winId) {
	var win = Ext.getCmp(winId);
	win.hide();
}

/* 显示 */
function showWindow(winId) {
	var win = Ext.getCmp(winId);
	win.show();
}

/* 弹出子窗口 */
function showChildWindow(winId,url,params,winTitle,wid,hei,maxable,minable){
	var _url;
	if(typeof(url)!='undefined'&& url!='' && url.length!=0){
		_url =url;
	}else{
		alert('url不能为空！')
	}
	if(typeof(params)!='undefined' &&params!='' && params.length!=0){
		if(_url.indexOf('?') ==-1){
			_url +='?'+params;
		}else{
			_url +='&'+params;
		}
	}

	if(wid=='' || wid==null){
		wid = 1000;
	}
	
	if(hei=='' || hei==null){
		hei=400;
	}
	
	if(!maxable){
		maxable = false;
	}
	
	if(!minable){
		minable = false;
	}
	
	//winTitle = '<div style="font-size:12px;">'+winTitle+'</div>';
	var html='<iframe src='+_url+' width="100%" height="100%" frameborder="0"></iframe>';
	var win=new Ext.Window({id:winId,title:winTitle,width:wid,height:hei,modal:true,maximizable:maxable,minimizable:minable,html:html});
	win.show();
}
